#ifndef CCYCLE_H_INCLUDED
#define CCYCLE_H_INCLUDED

#include "mhdef.h"
#include "cmd.h"


enum _CCYCLE_STATE { CYCLE_READY = 0, CYCLE_EXEC, CYCLE_STOP };

typedef enum _CCYCLE_STATE CCYCLE_STATE;

struct _CCYCLE
{
    CCYCLE_STATE state;
    short index;
    short index_start;
    short index_end;
    short group;
    short group_start;
    short group_end;
};

typedef struct _CCYCLE CCYCLE;

void ccycle_init(CCYCLE *cycle);
void ccycle_exec(CCYCLE *cycle);
void ccycle_exec_index(CCYCLE *cycle);
void ccycle_stop(CCYCLE *cycle);
CCYCLE_STATE ccycle_get_state(CCYCLE *cycle);
void ccycle_set_state(CCYCLE *cycle, CCYCLE_STATE state);

void ccycle_set_group(CCYCLE *cycle, short group);
void ccycle_set_start_group(CCYCLE *cycle, short group_start);
void ccycle_set_end_group(CCYCLE *cycle, short group_end);

short ccycle_get_group(CCYCLE *cycle);
short ccycle_get_start_group(CCYCLE *cycle);
short ccycle_get_end_group(CCYCLE *cycle);

void ccycle_set_index(CCYCLE *cycle, short index);
void ccycle_set_start_index(CCYCLE *cycle, short index_start);
void ccycle_set_end_index(CCYCLE *cycle, short index_end);

short ccycle_get_index(CCYCLE *cycle);
short ccycle_get_start_index(CCYCLE *cycle);
short ccycle_get_end_index(CCYCLE *cycle);

BOOL ccycle_complete(CCYCLE *cycle);
#endif // CCYCLE_H_INCLUDED
